package coder.nav.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 编辑器语言
 */
@Getter
@AllArgsConstructor
public enum NavIdeLangEnums {

    JAVA("Java", "☕️", "Java", "public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tSystem.out.println(\"Hello World~!\");\n\t}\n\n}"),
    PHP("PHP", "🐘", "PHP", "<?php\necho \"Hello World~!\";"),
    JAVASCRIPT("JavaScript", "🟡", "JavaScript", "\n\t\t\t\t\t⚙\uFE0F 个人设置\t\t  Setting\n\t\t\t\t\t\uD83D\uDCCC 记事本   \t   Memo\n\t\t\t\t\t\uD83D\uDEA5 编辑器\t\t   IDE\n\t\t\t\t\t\uD83D\uDCB0 记账本\t\t   Cash\n\t\t\t\t\t⏱\uFE0F 定时任务\t\t  Task\n\t\t\t\t\t\uD83D\uDCDD 文本文件 \t  Text\n\t\t\t\t\t\uD83D\uDCC2 文件夹   \t   Folder\n\t\t\t\t\t↪\uFE0F 退出登录\t\t  Logout\n\t\t\t\t\t\n\t\t\t\t\t▶\uFE0F 保存文本 \t  Ctrl + S\n\t\t\t\t\t⏩ 运行代码 \t  \t Ctrl + Enter\n\t\t\t\t\t⏩ 格式代码 \t  \t Ctrl + Alt + L"),
    // CPP("C++", "🆒", "C++", "#include <iostream>\n\nint main() {\n\tstd::cout << \"Hello World~!\" << std::endl;\n\treturn 0;\n}"),
    // PYTHON("Python", "🐍", "Python", "print(\"Hello World~!\")"),
    // GOLANG("Golang", "🌊", "Golang", "package main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println(\"Hello World~!\")\n}"),
    ;

    private final String key;
    private final String icon;
    private final String value;
    private final String template;

    public static String getTemplateByKey(String key) {
        NavIdeLangEnums[] es = NavIdeLangEnums.values();
        for(NavIdeLangEnums e : es) {
            if(e.getKey().equals(key)) {
                return e.getTemplate();
            }
        }
        return "";
    }

    public static NavIdeLangEnums getByCode(String code) {
        NavIdeLangEnums[] es = NavIdeLangEnums.values();
        for(NavIdeLangEnums e : es) {
            if(e.getKey().equals(code)) {
                return e;
            }
        }
        return null;
    }

}
